#! /usr/bin/env python
# -*- coding: utf-8 -*-

# *************************************************************
#  Copyright (c) JoinQuant Development Team
#
#  Author: Huayong Kuang <kuanghuayong@joinquant.com>
#  CreateTime: 2017-11-03 15:32:11 Friday
# *************************************************************

import logging

# 获取 root 记录器
root_log = logging.getLogger()
root_log.setLevel(logging.DEBUG)

formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')

sh = logging.StreamHandler()
sh.setLevel(logging.DEBUG)
sh.setFormatter(formatter)

root_log.addHandler(sh)
root_log.info(root_log.handlers)

# 创建主记录器
log = logging.getLogger('Main')
log.info("test main")

log2 = logging.getLogger('Main.B')
log2.info("test main b")

log3 = logging.getLogger("Main.B.C")
log3.error("test main b c")
